import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";


/* eslint-disable */
// Vue.config.productionTip = false;

// new Vue({
//   router,
//   store,
//   render: h => h(App)
// }).$mount("#app");
let instance = null
function render() {
  window.xxx = router
  console.log(window.xxx);
  instance = new Vue({
    router,
    store,
    render: h => h(App)
  }).$mount("#app"); // 挂载带自己的html，基座会拿到这个挂载后的html 插入进去
}

if (window.__POWERED_BY_QIANKUN__) {
  __webpack_public_path__ = window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__;
  console.log(__webpack_public_path__);
}
// 独立运行
if (!window.__POWERED_BY_QIANKUN__) {
  render();
}
window.mainRouter = null
// 子组件的协议
export async function bootstrap(props) {}
export async function mount(props) {
  // console.log(props.elementCom.install);
  Vue.use(props.elementCom)
  props.routers = router
  render(props)
  window.mainRouter = props.mainRouter
  // console.log(props);
  console.log('加载应用');
}
export async function unmount(props) {
  // console.log(instance);
  // instance.$destory() 报错
  console.log('卸载应用');
}